<?php
/**
* Bysoft
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com and you will be sent a copy immediately.
*
* @category   Bysoft
* @package    Bysoft_Flashnavigator
* @author     Bysoft
* @copyright  Copyright (c) 2009 Bysoft (http://www.bysoft.fr)
* @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*/ 
class Bysoft_flashnavigator_Block_Adminhtml_Flashnavigator_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
  public function __construct()
  {
      parent::__construct();
      $this->setId('flashnavigatorGrid');
      $this->setDefaultSort('flashnavigator_id');
      $this->setDefaultDir('ASC');
      $this->setSaveParametersInSession(true);
  }

  protected function _prepareCollection()
  {
      $collection = Mage::getModel('flashnavigator/flashnavigator')->getCollection();
      $this->setCollection($collection);
      return parent::_prepareCollection();
  }

  protected function _prepareColumns()
  {
      
		$this->addColumn('id', array(
			'header'    => Mage::helper('flashnavigator')->__('ID'),
			'align'     =>'right',
			'width'     => '50px',
			'index'     => 'id',
		));
		
		$this->addColumn('title', array(
			'header'    => Mage::helper('flashnavigator')->__('Title'),
			'align'     =>'left',
			'width'     => '200px',
			'index'     => 'title',
		));
		
	  /*
      $this->addColumn('content', array(
			'header'    => Mage::helper('flashnavigator')->__('Item Content'),
			'width'     => '150px',
			'index'     => 'content',
      ));
	  */
/*
      $this->addColumn('status', array(
          'header'    => Mage::helper('flashnavigator')->__('Status'),
          'align'     => 'left',
          'width'     => '80px',
          'index'     => 'status',
          'type'      => 'options',
          'options'   => array(
              1 => 'Enabled',
              2 => 'Disabled',
          ),
      ));
	*/  
/*
        $this->addColumn('action',
            array(
                'header'    =>  Mage::helper('flashnavigator')->__('Action'),
                'width'     => '100',
                'type'      => 'action',
                'getter'    => 'getId',
                'actions'   => array(
                    array(
                        'caption'   => Mage::helper('flashnavigator')->__('Edit'),*/
                      //  'url'       => array('base'=> '*/*/edit'),
                      /*
                        'field'     => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
                'is_system' => true,
        ));
        */
		
		//$this->addExportType('*/*/exportCsv', Mage::helper('flashnavigator')->__('CSV'));
		//$this->addExportType('*/*/exportXml', Mage::helper('flashnavigator')->__('XML'));
	  
      return parent::_prepareColumns();
  }

    protected function _prepareMassaction()
    {
        /*
    	$this->setMassactionIdField('flashnavigator_id');
        $this->getMassactionBlock()->setFormFieldName('flashnavigator');

        $this->getMassactionBlock()->addItem('delete', array(
             'label'    => Mage::helper('flashnavigator')->__('Delete'),*/
            // 'url'      => $this->getUrl('*/*/massDelete'),
          //   'confirm'  => Mage::helper('flashnavigator')->__('Are you sure?')
       // ));
		/*
        $statuses = Mage::getSingleton('flashnavigator/status')->getOptionArray();

        array_unshift($statuses, array('label'=>'', 'value'=>''));
        */
		/*
        $this->getMassactionBlock()->addItem('status', array(
             'label'=> Mage::helper('flashnavigator')->__('Change status'),*/
             //'url'  => $this->getUrl('*/*/massStatus', array('_current'=>true)),
             /*'additional' => array(
                    'visibility' => array(
                         'name' => 'status',
                         'type' => 'select',
                         'class' => 'required-entry',
                         'label' => Mage::helper('flashnavigator')->__('Status'),
                         'values' => $statuses
                     )
             )
        ));
        */
        return $this;
    }

  public function getRowUrl($row)
  {
      return $this->getUrl('*/*/edit', array('id' => $row->getId()));
  }

}